package DesignPatern.A14_迭代器模式.QSB.A02_基本模式;

import java.util.ArrayList;

/**
 * @Author: Du
 * @Date: 2021/8/2 8:32
 */
public class ProjectIterator implements IProjectIterator
{
    private ArrayList<IProject> projects = new ArrayList<>();
    private int currentItem = 0;
    
    public ProjectIterator(ArrayList<IProject> projects)
    {
        this.projects = projects;
    }
    
    @Override
    public boolean hasNext()
    {
        return !(this.currentItem >= projects.size() || this.projects.get(this.currentItem++) == null);
    }
    
    @Override
    public IProject next()
    {
        return (IProject) this.projects.get(this.currentItem++);
    }
    
    @Override
    public void remove()
    {
    
    }
}
